Data Feeds in Wolfram Finance Platform

Fahim Chandurwala

Wolfram Research Inc.

Integrating Bloomberg & Reuters Market Data

Contents

Configuration

Market Data Request

Real-Time Feeds

Output, Time-Series, Charting

Report Generation

Configuration

Configuring Bloomberg

MarketDataSourceConfigure["Bloomberg"]

Configure Reuters

MarketDataSourceConfigure["Reuters"]

Market Data Requests

Current Data

MarketData["IBM UN Equity","PX_LAST","Source"->"Bloomberg"]

MarketData["IBM.N","TRDPRC_1","Source"->"Reuters"]

MarketData[{"IBM.N","MSFT.O"},{"TRDPRC_1"},"Source"->"Reuters"]

MarketData[{"IBM US Equity","MSFT US Equity"},{"PX_LAST"},"Source"->"Bloomberg"]

MarketEvents

rawTickData=MarketData["IBM US Equity","MarketEvents",{{2014,10,17,10,30,00},{2014,10,17,10,31,00}},"Source"->"Bloomberg"]

Averaged/Market-Bar Data

avgData=MarketData["IBM US Equity","TRADE"->{"OPEN","HIGH","LOW","CLOSE","VOLUME","NUMEVENTS","VALUE"},{{2014,10,17,10,30,00},{2014,10,17,10,31,00}},"Source"->"Bloomberg"]

Comparing Raw-Data with Averaged/Market-Bar Data from Bloomberg

firstMinFromRawData=rawTickData[GroupBy[#type&]]

{firstMinFromRawData["TRADE",Total,#size&],avgData[1,"VOLUME"]}

{firstMinFromRawData["TRADE",Last,#value&],avgData[1,"CLOSE"]}

{firstMinFromRawData["TRADE",Length],avgData[1,"NUMEVENTS"]}

Real-Time

dataBloomberg:=MarketData[{"AAPL US Equity","MSFT US Equity"},{"BID","ASK","LAST_PRICE"},"Source"->"Bloomberg"]

Dynamic[dataBloomberg]

dataReuters:=MarketData[{"MSFT.OQ","AAPL.OQ"},{"BID","ASK"},"Source"->"Reuters"]

Dynamic[dataReuters]

Close[MarketDataSources[]]

Historical Data & Output Discussion

Query

instruments ={"AAPL US Equity","MSFT US Equity","TWTR US Equity","GOOGL US Equity"};
properties={"OPEN","PX_LAST","HIGH","LOW","VOLUME"};
bbgData=
MarketData[instruments,properties,{DateObject[{2014}],Yesterday},"PricingAdjustments"->{"Split"},"Source"->"Bloomberg"]

reutersData=MarketData[{"AAPL.O","MSFT.O","GOOGL.O","TWTR.N"},All,{DateObject[{2014}],Yesterday},"Source"->"Reuters"]

Create TimeSeries Object

tsReuters=reutersData[Select[#["Instrument"]=="MSFT.O"&],{#["Date"],#["CLOSE"]}&] [TimeSeries]

DateListPlot[tsReuters]

Create TradingChart

reutersData[
	Select[#["Instrument"]=="MSFT.O"&],
	{#["Date"],{#["OPEN"],#["HIGH"],#["LOW"],#["CLOSE"],#["VOLUME"]}}&
] [TradingChart]

reutersData[GroupBy[#Date&],SortBy[(#HIGH-#LOW)/#HIGH&]][Key[DateObject@{2014,9,9}]]

Time Series

bbgData[
GroupBy[#Instrument&],
GroupBy[#date&]][All,TimeSeries]

ts=bbgData[GroupBy[#date&],GroupBy[#Instrument&]][TimeSeries,All,1,"OPEN"]

ts[DateObject@{2014,1,2}]

bbgData[GroupBy[#Instrument&],All,{#date,#OPEN}&][All,TimeSeries]

Scoring & Average

Days corresponding to best closing prices (PX_LAST), YTD.

bbgData[GroupBy[#Instrument&],MaximalBy[#["PX_LAST"]&],#date&]

bbgData[GroupBy[#Instrument&],<|"Mean Closing Price"->Mean,"Std. Dev"->StandardDeviation,"Change"->Differences|>,#["PX_LAST"]&]

30-day avg

func=<|"Mean"->Mean,"Std. Dev"->StandardDeviation,"Change"->Differences|>;
thirtyDaysAgo=DayPlus[Today,-30,"BusinessDay"];

bbgData[Select[#date>thirtyDaysAgo&]][GroupBy[#Instrument&],func,{#["PX_LAST"],#["VOLUME"]}&]

MarketData[instruments,{"MOV_AVG_30D","VOLUME_AVG_30D"}]

A Good Day to Trade?

Group By DayName

bbgData[GroupBy[DayName[#date]&]]

Compute statistical properties (Mean and StndardDeviation) on a given instrument property (PX_LAST)

stats=bbgData[GroupBy[DayName[#date]&],GroupBy[#Instrument&],<|"Mean Closing Price"->Mean,"Std. Dev"->StandardDeviation|>,#["PX_LAST"]&]

Averaged Data for all Instruments on a given day

stats[Key@Thursday]

stats[All,"AAPL US Equity","Mean Closing Price"][ListLinePlot]

bb=bbgData[Select[#date<DateObject[{2014,2,1}]&]];
sbb=bb[GroupBy[DayName[#date]&],GroupBy[#Instrument&],<|"Mean Closing Price"->Mean,"Std. Dev"->StandardDeviation|>,#["PX_LAST"]&]

sbb[All,"AAPL US Equity","Mean Closing Price"][ListLinePlot]

Report Generation

args=<|"Author"->"WolframTechCOnference2014","Stocks"->{<|"Instrument"->"AAPL US Equity","Name"->"Apple"|>,<|"Instrument"->"AMZN US Equity","Name"->"amazon.com"|>}|>;

obj=GenerateDocument["C:\\Users\\fahimc\\workspace\\BloombergLink\\BloombergLink\\Documentation\\English\\HistoricalDataReportTemplate.nb",args]

expr=NotebookGet[obj];

CloudDeploy[expr]